package com.whynot.frame.designMode.factory.creator;

import com.whynot.frame.designMode.factory.producter.Ball;
import com.whynot.frame.designMode.factory.producter.Ball;

/**
 * 具体的创建球类的工厂，通过反射区实例化具体产品
 * @author Administrator
 *
 */
public class ConcreteCyPersonAbstractFatory extends PersonAbstractFatory{

	@Override
	public <T extends Ball> T newInstance(Class<T> t) {
		Ball ball = null;
		if(ball == null){
			try {
				ball = (T)Class.forName(t.getName()).newInstance();
			} catch (InstantiationException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return (T)ball;
	}
	
}
